<?php  include VIEWPATH.'common/head.php';  ?>
<script type="text/javascript">
    var status = '<?php echo $_GET['status'];?>';
    if(status == '-1'){
        alert('fail:<?php echo $_GET['msg'];?>');
    }
    function setCategoryDel(id, status){
        var url = "index.php?c=tag&m=set_status";
        var param = {"id":id, "status":status};
        common_ajax(url, param, function(data){
            if(data.errorCode == 0) {
                //表单提交
                window.location.href=  window.location.href;
                return true;
            }else{
                alert(data.errorMsg);
            }
        });
    }
</script>
<body class="gray-bg">
<div class="wrapper wrapper-content ">

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><?php echo $pageTitle;?></h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="pub_tag_talent">
                        <div class="add-btn" style="float:right;margin-bottom:5px;">
                            <a href="index.php?c=tag&m=tag_edit" class="btn btn-danger" data-toggle="modal" data-target="#tag_edit">添加</a>
                            <div class="modal fade" id="tag_edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
                                <div class="modal-dialog" style="width: 50%;"><div class="modal-content"></div></div>
                            </div>
                        </div>
                        <div class="clearfix"></div>

                        <table class="table">
                            <thead>
                            <tr class="active">
                                <th>分类ID</th>
                                <th>分类名称</th>
                                <th>状态</th>
                                <th></th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php foreach($categoryList as $category){ ?>
                                <tr>
                                    <td><?php echo $category['id']; ?></td>
                                    <td><?php echo $category['title']; ?></td>
                                    <td><?php echo $category['status'] == 1 ? "显示" : "隐藏"; ?></td>
                                    <td>
                                        <a href="index.php?c=tag&m=tag_edit&tag_id=<?php echo $category['id'];?>" data-toggle="modal" data-target="#tag_edit">编辑</a>
                                        <?php if($category['status'] == 1){ ?>
                                        <a href="javascript:void(0)" onclick="setCategoryDel(<?php echo $category['id'];?>, -1)">隐藏</a>
                                        <?php }else{ ?>
                                         <a href="javascript:void(0)" onclick="setCategoryDel(<?php echo $category['id'];?>, 1)">显示</a>
                                        <?php } ?>
                                    </td>
                                </tr>
                            <?php } ?>

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="http://gosspublic.alicdn.com/aliyun-oss-sdk-4.4.4.min.js"></script>
<?php  include VIEWPATH.'common/footer.php';  ?>
